# -*- coding: utf-8 -*-
"""
Created on Mon Jul 19 23:29:52 2021

@author: chibi
"""

import requests
import time 

url = "http://192.168.88.215/temp"

while True :
    i = []
    try :
        myurl =  requests.get(url , timeout= 5)
        text =  myurl.text
        #print(text)
        text = text.strip()
        text = text.replace("\n\r", ",")
        i = text.split(",")
        #print(i)
        k = []
        for x  in range(len(i)):
            k.append(i[x].split(":"))
        
        #print(k)
        if k[5][1] == "1":
            s = "自动"
        else:s="手动"
        print("当前模式%s\n当前湿度:%s 当前温度%s 默认温度:%s 默认温度:%s 继电器开关状态:%s" % (s,k[0][1],k[1][1],k[3][1],k[4][1],k[2][1]) )
            
        
        
    except requests.exceptions.RequestException as err:
        print("网页超时请求\n")
    
    time.sleep(5)